package com.lkd.feign;

import com.lkd.feign.fallback.VmServiceFallbackFactory;
import com.lkd.vo.SkuVO;
import com.lkd.vo.VmVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "vm-service",fallbackFactory = VmServiceFallbackFactory.class)
public interface VMService{

    @GetMapping("/vm/info/{innerCode}")
    VmVO getVMInfo(@PathVariable String innerCode);

    @GetMapping("/vm/skuList/{innerCode}")
    List<SkuVO> getSkuListByInnerCode(@PathVariable String innerCode);

    /**
     * 根据商品id查询商品
     * @param skuId
     * @return
     */
    @GetMapping("/sku/{skuId}")
    SkuVO getSku(@PathVariable String skuId);


    @GetMapping("/vm/hasCapacity/{innerCode}/{skuId}")
    Boolean hasCapacity(@PathVariable String innerCode,@PathVariable Long skuId);

    /**
     * 获取点位名称
     * @param id
     * @return
     */
    @GetMapping("/node/nodeName/{id}")
    String getNodeName(@PathVariable Long id);

    /**
     * 修改售货机状态
     * @param status  状态  售货机状态，0:未投放;1-运营;3-撤机
     * @param innerCode 售货机编码
     * @return true 售货机存在修改成功  false 修改失败
     */
    @PutMapping("/vm/status/{innerCode}")
    public boolean changeStatus(@RequestParam("status") int status,
                                @PathVariable("innerCode") String innerCode);
}
